/*
 * Copyright：fxsen <br/>
 * Date: 2021/12/21 9:59 <br/>
 * Author: <a href="mailto:fxsen@foxmail.com">fxsen</a>
 */
package com.fxsen.commons.sysmanager.core.service.impl;
import com.fxsen.commons.core.base.common.service.impl.CommonServiceImpl;
import com.fxsen.commons.sysmanager.core.entity.SsoConfig;
import com.fxsen.commons.sysmanager.core.mapper.SsoMapper;
import com.fxsen.commons.sysmanager.core.service.ISsoConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @describe: <br/>
 * @date: 2021/12/21 9:59 <br/>
 * @author: <a href="mailto:fxsen@foxmail.com">fxsen</a>
 */
@Service
public class SsoConfigServiceImpl extends CommonServiceImpl<SsoMapper,SsoConfig> implements ISsoConfigService {
    @Autowired
    private SsoMapper ssoMapper;
    @Override
    public boolean exists(String clientId) {
        SsoConfig sso = ssoMapper.selectByClientId(clientId);
        if (null == sso){
            return false;
        }
        return null != ssoMapper.selectByClientId(clientId);
    }

    @Override
    public SsoConfig selectByClientId(String clientId) {
        return ssoMapper.selectByClientId(clientId);
    }

    /*@Override
    public Result<Void> validate(String clientId, String clientSecret) {
        Sso sso = ssoMapper.selectByClientId(clientId);
        if (null == sso) {
            return Result.createError("clientId不存在");
        }
        if (clientId.equals(sso.getClientId())){
            return Result.success();
        }else {
            return Result.createError("clientSecret有误");
        }
    }*/
}
